/**
    Copyright (C) 2011  Alexander Vollmer

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.jefb.service.impl;

import org.jefb.entity.dto.FileToken;
import org.jefb.entity.dto.TransmissionCallback;
import org.jefb.sec.entity.AgentAuthResponse;
import org.jefb.sec.entity.AgentAuthenticationRequest;
import org.jefb.sec.entity.TransInitRequest;
import org.jefb.sec.entity.TransInitResponse;
import org.jefb.sec.service.ITransInitService;
import org.jefb.service.IReceiverService;
import org.jefb.service.IRemoteProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RemoteProxy implements IRemoteProxy{
	
	//private static Logger log = LoggerFactory.getLogger(RemoteProxy.class);
	
	//services
	@Autowired
	private ITransInitService transInitService;
	@Autowired
	private IReceiverService receiverService;

	public AgentAuthResponse auth(AgentAuthenticationRequest authRequest) {
		return transInitService.auth(authRequest);
	}

	public TransInitResponse init(TransInitRequest transInitRequest) {
		System.out.println("Initializing transmission.");
		return transInitService.init(transInitRequest);
	}

	public TransmissionCallback receive(FileToken fileToken) {
		return receiverService.receive(fileToken);
	}

	public void setTransInitService(ITransInitService transInitService) {
		this.transInitService = transInitService;
	}

	public ITransInitService getTransInitService() {
		return transInitService;
	}

	public void setReceiverService(IReceiverService receiverService) {
		this.receiverService = receiverService;
	}

	public IReceiverService getReceiverService() {
		return receiverService;
	}

}
